package com.jt.controller;

import com.jt.pojo.Rights;
import com.jt.service.RightService;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/rights")
public class RightController {

    @Autowired
    private RightService rightService;

    @GetMapping("/findAll")
    public List<Rights> findAll(){
        return rightService.findAll();
    }

    /**
     * 查询左侧菜单列表,一级套二级
     * URL:rights/getRightsList
     * 参数：没有参数
     * 返回值：SysResult（list）
     */
    @GetMapping("/getRightsList")
    public SysResult getRightsList(){
        List<Rights> rightsList =rightService.getRightsList();
        return SysResult.success(rightsList);
    }
}
